\hypertarget{uc3__spi_2spi__master_8h}{
\section{spi\-\_\-master.h \-File \-Reference}
\label{uc3__spi_2spi__master_8h}\index{spi\-\_\-master.\-h@{spi\-\_\-master.\-h}}
}


\-S\-P\-I \-Master driver for \-A\-V\-R \-U\-C3.  


{\ttfamily \#include \char`\"{}compiler.\-h\char`\"{}}\*
{\ttfamily \#include \char`\"{}sysclk.\-h\char`\"{}}\*
{\ttfamily \#include \char`\"{}status\-\_\-codes.\-h\char`\"{}}\*
{\ttfamily \#include \char`\"{}spi.\-h\char`\"{}}\*
{\ttfamily \#include \char`\"{}conf\-\_\-spi\-\_\-master.\-h\char`\"{}}\*
\subsection*{\-Data \-Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structspi__device}{spi\-\_\-device}
\begin{DoxyCompactList}\small\item\em \-Polled \-S\-P\-I device defintion. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Defines}
\begin{Indent}\paragraph*{\-Spi \-Master \-Management \-Configuration}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{uc3__spi_2spi__master_8h_a2e703725551c981e6c53c149d179b5ea}{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S}~0
\begin{DoxyCompactList}\small\item\em \-Default \-Config \-Spi \-Master \-Delay \-B\-C\-S. \end{DoxyCompactList}\item 
\#define \hyperlink{uc3__spi_2spi__master_8h_ae8f69c3f97cc5f256da40ea4009ed004}{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R}~8
\begin{DoxyCompactList}\small\item\em \-Default \-Config \-Spi \-Master \-Bits per \-Transfer \-Definition. \end{DoxyCompactList}\item 
\#define \hyperlink{uc3__spi_2spi__master_8h_a9191538dc45075e8db54b0ce71854830}{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T}~0
\begin{DoxyCompactList}\small\item\em \-Default \-Config \-Spi \-Master \-Delay \-B\-C\-T. \end{DoxyCompactList}\item 
\#define \hyperlink{uc3__spi_2spi__master_8h_acf9c81ee4bbe25a4f7ce9323950df30a}{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S}~0
\begin{DoxyCompactList}\small\item\em \-Default \-Config \-Spi \-Master \-Delay \-B\-S. \end{DoxyCompactList}\item 
\#define \hyperlink{uc3__spi_2spi__master_8h_a64f5ff62d19aab1a97cc5e72e062be49}{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y}~0x\-F\-F
\begin{DoxyCompactList}\small\item\em \-Default \-Config \-Spi \-Master \-Dummy \-Field. \end{DoxyCompactList}\end{DoxyCompactItemize}
\end{Indent}
\subsection*{\-Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef uint8\-\_\-t \hyperlink{uc3__spi_2spi__master_8h_a781db101a4c4490735eb12d3cb92fde7}{spi\-\_\-flags\-\_\-t}
\begin{DoxyCompactList}\small\item\em \-Spi \-Flags definition. \end{DoxyCompactList}\item 
typedef uint8\-\_\-t \hyperlink{uc3__spi_2spi__master_8h_a0216987e3f93d6bd7392bb7f28c3db2c}{board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t}
\begin{DoxyCompactList}\small\item\em \-Board \-Spi \-Select \-Id \-Definition. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{uc3__spi_2spi__master_8h_adb8e173ada01040ae56a5f5868b50449}{spi\-\_\-master\-\_\-setup\-\_\-device} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi, struct \hyperlink{structspi__device}{spi\-\_\-device} $\ast$device, \hyperlink{uc3__spi_2spi__master_8h_a781db101a4c4490735eb12d3cb92fde7}{spi\-\_\-flags\-\_\-t} flags, uint32\-\_\-t baud\-\_\-rate, \hyperlink{uc3__spi_2spi__master_8h_a0216987e3f93d6bd7392bb7f28c3db2c}{board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t} sel\-\_\-id)
\begin{DoxyCompactList}\small\item\em \-Setup a \-S\-P\-I device. \end{DoxyCompactList}\item 
void \hyperlink{uc3__spi_2spi__master_8h_ac93e5990e8abc811f4ba2fb65e10e94d}{spi\-\_\-enable} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Enables the \-S\-P\-I. \end{DoxyCompactList}\item 
void \hyperlink{uc3__spi_2spi__master_8h_a5cc4ac60e6ecf3cdc442265aaa0a63e0}{spi\-\_\-disable} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Disables the \-S\-P\-I. \end{DoxyCompactList}\item 
int \hyperlink{uc3__spi_2spi__master_8h_aa945d35a658c234e2cb650a53dcdaa37}{spi\-\_\-is\-\_\-enabled} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Tests if the \-S\-P\-I is enabled. \end{DoxyCompactList}\item 
\hyperlink{status__codes_8h_a1f12e07903f974729de22ebe2f52273e}{status\-\_\-code\-\_\-t} \hyperlink{uc3__spi_2spi__master_8h_a5eea18b25801b83f702f8ff49cfebc54}{spi\-\_\-write\-\_\-packet} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi, const uint8\-\_\-t $\ast$data, size\-\_\-t len)
\begin{DoxyCompactList}\small\item\em \-Send a sequence of bytes to a \-S\-P\-I device. \end{DoxyCompactList}\item 
\hyperlink{status__codes_8h_a1f12e07903f974729de22ebe2f52273e}{status\-\_\-code\-\_\-t} \hyperlink{uc3__spi_2spi__master_8h_aafdacdffa212b9880873c82b0fb6d8e7}{spi\-\_\-read\-\_\-packet} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi, uint8\-\_\-t $\ast$data, size\-\_\-t len)
\begin{DoxyCompactList}\small\item\em \-Receive a sequence of bytes from a \-S\-P\-I device. \end{DoxyCompactList}\item 
bool \hyperlink{uc3__spi_2spi__master_8h_a7a08995ae2193f27979fdd0613f3f189}{spi\-\_\-is\-\_\-tx\-\_\-empty} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Checks if all transmissions are complete. \end{DoxyCompactList}\item 
bool \hyperlink{uc3__spi_2spi__master_8h_afc0784fc74e3a9c6bbf5de5aa87a413f}{spi\-\_\-is\-\_\-tx\-\_\-ready} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Checks if all transmissions is ready. \end{DoxyCompactList}\item 
bool \hyperlink{uc3__spi_2spi__master_8h_a8ec4bf90b5b8de62f3ce6aae2fdfa752}{spi\-\_\-is\-\_\-rx\-\_\-full} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Check if the \-S\-P\-I contains a received character. \end{DoxyCompactList}\item 
bool \hyperlink{uc3__spi_2spi__master_8h_aa137d54c8ea3799cf6f2b2c710569be6}{spi\-\_\-is\-\_\-rx\-\_\-ready} (volatile avr32\-\_\-spi\-\_\-t $\ast$spi)
\begin{DoxyCompactList}\small\item\em \-Checks if all reception is ready. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}
\-S\-P\-I \-Master driver for \-A\-V\-R \-U\-C3. \-This file defines a useful set of functions for the \-S\-P\-I interface on \-A\-V\-R \-U\-C3 devices.


\begin{DoxyItemize}
\item \-Compiler\-: \-I\-A\-R \-E\-W\-A\-V\-R32 and \-G\-N\-U \-G\-C\-C for \-A\-V\-R \-U\-C3
\item \-Supported devices\-: \-All \-A\-V\-R \-U\-C3 devices with an \-S\-P\-I module can be used.
\item \-App\-Note\-:
\end{DoxyItemize}

\begin{DoxyAuthor}{\-Author}
\-Atmel \-Corporation\-: \href{http://www.atmel.com}{\tt http\-://www.\-atmel.\-com} \par
 \-Support and \-F\-A\-Q\-: \href{http://support.atmel.no/}{\tt http\-://support.\-atmel.\-no/} 
\end{DoxyAuthor}


\subsection{\-Define \-Documentation}
\hypertarget{uc3__spi_2spi__master_8h_ae8f69c3f97cc5f256da40ea4009ed004}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R}}
\index{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define \-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-B\-I\-T\-S\-\_\-\-P\-E\-R\-\_\-\-T\-R\-A\-N\-S\-F\-E\-R~8}}
\label{uc3__spi_2spi__master_8h_ae8f69c3f97cc5f256da40ea4009ed004}


\-Default \-Config \-Spi \-Master \-Bits per \-Transfer \-Definition. 

\hypertarget{uc3__spi_2spi__master_8h_a2e703725551c981e6c53c149d179b5ea}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S}}
\index{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S}]{\setlength{\rightskip}{0pt plus 5cm}\#define \-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-S~0}}
\label{uc3__spi_2spi__master_8h_a2e703725551c981e6c53c149d179b5ea}


\-Default \-Config \-Spi \-Master \-Delay \-B\-C\-S. 

\hypertarget{uc3__spi_2spi__master_8h_a9191538dc45075e8db54b0ce71854830}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T}}
\index{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T}]{\setlength{\rightskip}{0pt plus 5cm}\#define \-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-C\-T~0}}
\label{uc3__spi_2spi__master_8h_a9191538dc45075e8db54b0ce71854830}


\-Default \-Config \-Spi \-Master \-Delay \-B\-C\-T. 

\hypertarget{uc3__spi_2spi__master_8h_acf9c81ee4bbe25a4f7ce9323950df30a}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S}}
\index{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S}]{\setlength{\rightskip}{0pt plus 5cm}\#define \-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-E\-L\-A\-Y\-\_\-\-B\-S~0}}
\label{uc3__spi_2spi__master_8h_acf9c81ee4bbe25a4f7ce9323950df30a}


\-Default \-Config \-Spi \-Master \-Delay \-B\-S. 

\hypertarget{uc3__spi_2spi__master_8h_a64f5ff62d19aab1a97cc5e72e062be49}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y}}
\index{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y@{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{\-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y}]{\setlength{\rightskip}{0pt plus 5cm}\#define \-C\-O\-N\-F\-I\-G\-\_\-\-S\-P\-I\-\_\-\-M\-A\-S\-T\-E\-R\-\_\-\-D\-U\-M\-M\-Y~0x\-F\-F}}
\label{uc3__spi_2spi__master_8h_a64f5ff62d19aab1a97cc5e72e062be49}


\-Default \-Config \-Spi \-Master \-Dummy \-Field. 



\subsection{\-Typedef \-Documentation}
\hypertarget{uc3__spi_2spi__master_8h_a0216987e3f93d6bd7392bb7f28c3db2c}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t@{board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t}}
\index{board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t@{board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef uint8\-\_\-t {\bf board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t}}}
\label{uc3__spi_2spi__master_8h_a0216987e3f93d6bd7392bb7f28c3db2c}


\-Board \-Spi \-Select \-Id \-Definition. 

\hypertarget{uc3__spi_2spi__master_8h_a781db101a4c4490735eb12d3cb92fde7}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-flags\-\_\-t@{spi\-\_\-flags\-\_\-t}}
\index{spi\-\_\-flags\-\_\-t@{spi\-\_\-flags\-\_\-t}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-flags\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef uint8\-\_\-t {\bf spi\-\_\-flags\-\_\-t}}}
\label{uc3__spi_2spi__master_8h_a781db101a4c4490735eb12d3cb92fde7}


\-Spi \-Flags definition. 



\subsection{\-Function \-Documentation}
\hypertarget{uc3__spi_2spi__master_8h_a5cc4ac60e6ecf3cdc442265aaa0a63e0}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-disable@{spi\-\_\-disable}}
\index{spi\-\_\-disable@{spi\-\_\-disable}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-disable}]{\setlength{\rightskip}{0pt plus 5cm}void spi\-\_\-disable (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_a5cc4ac60e6ecf3cdc442265aaa0a63e0}


\-Disables the \-S\-P\-I. 

\-Ensures that nothing is transferred while setting up buffers.


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance.\\
\hline
\end{DoxyParams}
\begin{DoxyWarning}{\-Warning}
\-This may cause data loss if used on a slave \-S\-P\-I. 
\end{DoxyWarning}
\hypertarget{uc3__spi_2spi__master_8h_ac93e5990e8abc811f4ba2fb65e10e94d}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-enable@{spi\-\_\-enable}}
\index{spi\-\_\-enable@{spi\-\_\-enable}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-enable}]{\setlength{\rightskip}{0pt plus 5cm}void spi\-\_\-enable (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_ac93e5990e8abc811f4ba2fb65e10e94d}


\-Enables the \-S\-P\-I. 


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance. \\
\hline
\end{DoxyParams}
\hypertarget{uc3__spi_2spi__master_8h_aa945d35a658c234e2cb650a53dcdaa37}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-is\-\_\-enabled@{spi\-\_\-is\-\_\-enabled}}
\index{spi\-\_\-is\-\_\-enabled@{spi\-\_\-is\-\_\-enabled}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-is\-\_\-enabled}]{\setlength{\rightskip}{0pt plus 5cm}int spi\-\_\-is\-\_\-enabled (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_aa945d35a658c234e2cb650a53dcdaa37}


\-Tests if the \-S\-P\-I is enabled. 


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
{\ttfamily 1} if the \-S\-P\-I is enabled, otherwise {\ttfamily 0}. 
\end{DoxyReturn}
\hypertarget{uc3__spi_2spi__master_8h_a8ec4bf90b5b8de62f3ce6aae2fdfa752}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-is\-\_\-rx\-\_\-full@{spi\-\_\-is\-\_\-rx\-\_\-full}}
\index{spi\-\_\-is\-\_\-rx\-\_\-full@{spi\-\_\-is\-\_\-rx\-\_\-full}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-is\-\_\-rx\-\_\-full}]{\setlength{\rightskip}{0pt plus 5cm}bool spi\-\_\-is\-\_\-rx\-\_\-full (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_a8ec4bf90b5b8de62f3ce6aae2fdfa752}


\-Check if the \-S\-P\-I contains a received character. 


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
{\ttfamily 1} if the \-S\-P\-I \-Receive \-Holding \-Register is full, otherwise {\ttfamily 0}. 
\end{DoxyReturn}
\hypertarget{uc3__spi_2spi__master_8h_aa137d54c8ea3799cf6f2b2c710569be6}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-is\-\_\-rx\-\_\-ready@{spi\-\_\-is\-\_\-rx\-\_\-ready}}
\index{spi\-\_\-is\-\_\-rx\-\_\-ready@{spi\-\_\-is\-\_\-rx\-\_\-ready}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-is\-\_\-rx\-\_\-ready}]{\setlength{\rightskip}{0pt plus 5cm}bool spi\-\_\-is\-\_\-rx\-\_\-ready (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_aa137d54c8ea3799cf6f2b2c710569be6}


\-Checks if all reception is ready. 


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
{\ttfamily 1} if the \-S\-P\-I \-Receiver is ready, otherwise {\ttfamily 0}. 
\end{DoxyReturn}
\hypertarget{uc3__spi_2spi__master_8h_a7a08995ae2193f27979fdd0613f3f189}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-is\-\_\-tx\-\_\-empty@{spi\-\_\-is\-\_\-tx\-\_\-empty}}
\index{spi\-\_\-is\-\_\-tx\-\_\-empty@{spi\-\_\-is\-\_\-tx\-\_\-empty}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-is\-\_\-tx\-\_\-empty}]{\setlength{\rightskip}{0pt plus 5cm}bool spi\-\_\-is\-\_\-tx\-\_\-empty (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_a7a08995ae2193f27979fdd0613f3f189}


\-Checks if all transmissions are complete. 


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
\-Status. 
\end{DoxyReturn}

\begin{DoxyRetVals}{\-Return values}
{\em 1} & \-All transmissions complete. \\
\hline
{\em 0} & \-Transmissions not complete. \\
\hline
\end{DoxyRetVals}
\hypertarget{uc3__spi_2spi__master_8h_afc0784fc74e3a9c6bbf5de5aa87a413f}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-is\-\_\-tx\-\_\-ready@{spi\-\_\-is\-\_\-tx\-\_\-ready}}
\index{spi\-\_\-is\-\_\-tx\-\_\-ready@{spi\-\_\-is\-\_\-tx\-\_\-ready}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-is\-\_\-tx\-\_\-ready}]{\setlength{\rightskip}{0pt plus 5cm}bool spi\-\_\-is\-\_\-tx\-\_\-ready (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_afc0784fc74e3a9c6bbf5de5aa87a413f}


\-Checks if all transmissions is ready. 


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{\-Returns}
\-Status. 
\end{DoxyReturn}

\begin{DoxyRetVals}{\-Return values}
{\em 1} & \-All transmissions complete. \\
\hline
{\em 0} & \-Transmissions not complete. \\
\hline
\end{DoxyRetVals}
\hypertarget{uc3__spi_2spi__master_8h_adb8e173ada01040ae56a5f5868b50449}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-master\-\_\-setup\-\_\-device@{spi\-\_\-master\-\_\-setup\-\_\-device}}
\index{spi\-\_\-master\-\_\-setup\-\_\-device@{spi\-\_\-master\-\_\-setup\-\_\-device}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-master\-\_\-setup\-\_\-device}]{\setlength{\rightskip}{0pt plus 5cm}void spi\-\_\-master\-\_\-setup\-\_\-device (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi, }
\item[{struct {\bf spi\-\_\-device} $\ast$}]{device, }
\item[{{\bf spi\-\_\-flags\-\_\-t}}]{flags, }
\item[{uint32\-\_\-t}]{baud\-\_\-rate, }
\item[{{\bf board\-\_\-spi\-\_\-select\-\_\-id\-\_\-t}}]{sel\-\_\-id}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_adb8e173ada01040ae56a5f5868b50449}


\-Setup a \-S\-P\-I device. 

\-The returned device descriptor structure must be passed to the driver whenever that device should be used as current slave device.


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance. \\
\hline
{\em device} & \-Pointer to \-S\-P\-I device struct that should be initialized. \\
\hline
{\em flags} & \-S\-P\-I configuration flags. \-Common flags for all implementations are the \-S\-P\-I modes \-S\-P\-I\-\_\-\-M\-O\-D\-E\-\_\-0 ... \-S\-P\-I\-\_\-\-M\-O\-D\-E\-\_\-3. \\
\hline
{\em baud\-\_\-rate} & \-Baud rate for communication with slave device in \-Hz. \\
\hline
{\em sel\-\_\-id} & \-Board specific seclet id \\
\hline
\end{DoxyParams}
\hypertarget{uc3__spi_2spi__master_8h_aafdacdffa212b9880873c82b0fb6d8e7}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-read\-\_\-packet@{spi\-\_\-read\-\_\-packet}}
\index{spi\-\_\-read\-\_\-packet@{spi\-\_\-read\-\_\-packet}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-read\-\_\-packet}]{\setlength{\rightskip}{0pt plus 5cm}{\bf status\-\_\-code\-\_\-t} spi\-\_\-read\-\_\-packet (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi, }
\item[{uint8\-\_\-t $\ast$}]{data, }
\item[{size\-\_\-t}]{len}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_aafdacdffa212b9880873c82b0fb6d8e7}


\-Receive a sequence of bytes from a \-S\-P\-I device. 

\-All bytes sent out on \-S\-P\-I bus are sent as value 0.


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance. \\
\hline
{\em data} & \-Data buffer to read \\
\hline
{\em len} & \-Length of data\\
\hline
\end{DoxyParams}
\begin{DoxyPrecond}{\-Precondition}
\-S\-P\-I device must be selected with spi\-\_\-select\-\_\-device() first 
\end{DoxyPrecond}
\hypertarget{uc3__spi_2spi__master_8h_a5eea18b25801b83f702f8ff49cfebc54}{
\index{uc3\-\_\-spi/spi\-\_\-master.\-h@{uc3\-\_\-spi/spi\-\_\-master.\-h}!spi\-\_\-write\-\_\-packet@{spi\-\_\-write\-\_\-packet}}
\index{spi\-\_\-write\-\_\-packet@{spi\-\_\-write\-\_\-packet}!uc3_spi/spi_master.h@{uc3\-\_\-spi/spi\-\_\-master.\-h}}
\subsubsection[{spi\-\_\-write\-\_\-packet}]{\setlength{\rightskip}{0pt plus 5cm}{\bf status\-\_\-code\-\_\-t} spi\-\_\-write\-\_\-packet (
\begin{DoxyParamCaption}
\item[{volatile avr32\-\_\-spi\-\_\-t $\ast$}]{spi, }
\item[{const uint8\-\_\-t $\ast$}]{data, }
\item[{size\-\_\-t}]{len}
\end{DoxyParamCaption}
)}}
\label{uc3__spi_2spi__master_8h_a5eea18b25801b83f702f8ff49cfebc54}


\-Send a sequence of bytes to a \-S\-P\-I device. 

\-Received bytes on the \-S\-P\-I bus are discarded.


\begin{DoxyParams}{\-Parameters}
{\em spi} & \-Base address of the \-S\-P\-I instance. \\
\hline
{\em data} & \-Data buffer to write \\
\hline
{\em len} & \-Length of data\\
\hline
\end{DoxyParams}
\begin{DoxyPrecond}{\-Precondition}
\-S\-P\-I device must be selected with spi\-\_\-select\-\_\-device() first 
\end{DoxyPrecond}
